<?php

	require_once(APPPATH . 'controllers/base_controllers/base_validation_controller.php');
	
	class Reports_validation extends Base_validation_controller
	{
		
		public function __construct()
		{
			parent::__construct();
			
			$this->load->library('validation');
			$this->load->model('values/cwr_registrant_member_homepage_value');
		}
		
		public function validate_members()
		{
			$rules['memberlastname'] = "trim|max_length[16]";
			$rules['memberfirstname'] = "trim|max_length[16]";
			$rules['membercity'] = "trim|max_length[16]";
			$rules['memberstate'] = "trim|max_length[16]";
			
			$this->validation->set_rules($rules);	
			$validationPassed = $this->validation->run();
			
			if($validationPassed)
			{
				echo( 'VALIDATION_SUCCESS' );
			}
			else
			{
				echo( $this->clean_validation_errors_validate_members( $this->validation->error_string ) );
			}
			
			die;
		}

		public function validate_registered_households()
		{
			$rules['memberlastname'] = "trim|max_length[16]";
			$rules['memberfirstname'] = "trim|max_length[16]";
			$rules['membercity'] = "trim|max_length[16]";
			$rules['memberstate'] = "trim|max_length[16]";
			
			$this->validation->set_rules($rules);	
			$validationPassed = $this->validation->run();
			
			if($validationPassed)
			{
				echo( 'VALIDATION_SUCCESS' );
			}
			else
			{
				echo( $this->clean_validation_errors_validate_registered_households( $this->validation->error_string ) );
			}
			
			die;
		}
			
		public function validate_balavihar_admin()
		{
			$rules['memberlastname'] = "trim|max_length[16]";
			$rules['memberfirstname'] = "trim|max_length[16]";
			$rules['membercity'] = "trim|max_length[16]";
			$rules['memberstate'] = "trim|max_length[16]";
			
			$this->validation->set_rules($rules);	
			$validationPassed = $this->validation->run();
			
			if($validationPassed)
			{
				echo( 'VALIDATION_SUCCESS' );
			}
			else
			{
				echo( $this->clean_validation_errors_validate_balavihar_admin( $this->validation->error_string ) );
			}
			
			die;
		}

		public function validate_balavihar_class_assignment()
		{
			echo( 'VALIDATION_SUCCESS' );
			
			die;
		}
        public function validate_all_balavihar_class_assignment()
        {
            echo( 'VALIDATION_SUCCESS' );
            
            die;
        }

		
		public function validate_balavihar_class_attendance()
		{
			echo( 'VALIDATION_SUCCESS' );
			
			die;
		}

		public function validate_language_admin()
		{
			$rules['memberlastname'] = "trim|max_length[16]";
			$rules['memberfirstname'] = "trim|max_length[16]";
			$rules['membercity'] = "trim|max_length[16]";
			$rules['memberstate'] = "trim|max_length[16]";
			
			$this->validation->set_rules($rules);	
			$validationPassed = $this->validation->run();
			
			if($validationPassed)
			{
				echo( 'VALIDATION_SUCCESS' );
			}
			else
			{
				echo( $this->clean_validation_errors_validate_language_admin( $this->validation->error_string ) );
			}
			
			die;
		}

		public function validate_balavihar()
		{
			$rules['memberlastname'] = "trim|max_length[16]";
			$rules['memberfirstname'] = "trim|max_length[16]";
			$rules['membercity'] = "trim|max_length[16]";
			$rules['memberstate'] = "trim|max_length[16]";
			
			$this->validation->set_rules($rules);	
			$validationPassed = $this->validation->run();
			
			if($validationPassed)
			{
				echo( 'VALIDATION_SUCCESS' );
			}
			else
			{
				echo( $this->clean_validation_errors_validate_balavihar( $this->validation->error_string ) );
			}
			
			die;
		}

		public function validate_swamivisits_admin()
		{
			$rules['memberlastname'] = "trim|max_length[16]";
			$rules['memberfirstname'] = "trim|max_length[16]";
			
			$this->validation->set_rules($rules);	
			$validationPassed = $this->validation->run();
			
			if($validationPassed)
			{
				echo( 'VALIDATION_SUCCESS' );
			}
			else
			{
				echo( $this->clean_validation_errors_validate_swamivisits_admin( $this->validation->error_string ) );
			}
			
			die;
		}

		public function validate_banquet_admin()
		{
			$rules['memberlastname'] = "trim|max_length[16]";
			$rules['memberfirstname'] = "trim|max_length[16]";
			
			$this->validation->set_rules($rules);	
			$validationPassed = $this->validation->run();
			
			if($validationPassed)
			{
				echo( 'VALIDATION_SUCCESS' );
			}
			else
			{
				echo( $this->clean_validation_errors_validate_banquet_admin( $this->validation->error_string ) );
			}
			
			die;
		}

		public function validate_mahasamadhi_registrants()
		{
			$rules['registrantlastname'] = "trim|max_length[16]";
			$rules['registrantfirstname'] = "trim|max_length[16]";
			$rules['registrantcity'] = "trim|max_length[16]";
			$rules['registrantstate'] = "trim|max_length[16]";
			
			$this->validation->set_rules($rules);	
			$validationPassed = $this->validation->run();
			
			if($validationPassed)
			{
				echo( 'VALIDATION_SUCCESS' );
			}
			else
			{
				echo( $this->clean_validation_errors_validate_mahasamadhi_registrants( $this->validation->error_string ) );
			}
			
			die;
		}

		private function clean_validation_errors_validate_members( $valErrors )
		{
			$valErrors = str_replace("memberlastname", "Member last name", $valErrors);
			$valErrors = str_replace("memberfirstname", "Member first name", $valErrors);
			$valErrors = str_replace("membercity", "Member city", $valErrors);
			$valErrors = str_replace("memberstate", "Member state", $valErrors);
						
			return $valErrors;
		}
		
		private function clean_validation_errors_validate_registered_households( $valErrors )
		{
			$valErrors = str_replace("memberlastname", "Member last name", $valErrors);
			$valErrors = str_replace("memberfirstname", "Member first name", $valErrors);
			$valErrors = str_replace("membercity", "Member city", $valErrors);
			$valErrors = str_replace("memberstate", "Member state", $valErrors);
						
			return $valErrors;
		}
		
		private function clean_validation_errors_validate_balavihar_admin( $valErrors )
		{
			$valErrors = str_replace("memberlastname", "Member last name", $valErrors);
			$valErrors = str_replace("memberfirstname", "Member first name", $valErrors);
			$valErrors = str_replace("membercity", "Member city", $valErrors);
			$valErrors = str_replace("memberstate", "Member state", $valErrors);
						
			return $valErrors;
		}

		private function clean_validation_errors_validate_balavihar( $valErrors )
		{
			$valErrors = str_replace("memberlastname", "Member last name", $valErrors);
			$valErrors = str_replace("memberfirstname", "Member first name", $valErrors);
			$valErrors = str_replace("membercity", "Member city", $valErrors);
			$valErrors = str_replace("memberstate", "Member state", $valErrors);
						
			return $valErrors;
		}

		private function clean_validation_errors_validate_language_admin( $valErrors )
		{
			$valErrors = str_replace("memberlastname", "Member last name", $valErrors);
			$valErrors = str_replace("memberfirstname", "Member first name", $valErrors);
			$valErrors = str_replace("membercity", "Member city", $valErrors);
			$valErrors = str_replace("memberstate", "Member state", $valErrors);
						
			return $valErrors;
		}

		private function clean_validation_errors_validate_swamivisits_admin( $valErrors )
		{
			$valErrors = str_replace("memberlastname", "Member last name", $valErrors);
			$valErrors = str_replace("memberfirstname", "Member first name", $valErrors);
						
			return $valErrors;
		}

		private function clean_validation_errors_validate_banquet_admin( $valErrors )
		{
			$valErrors = str_replace("memberlastname", "Member last name", $valErrors);
			$valErrors = str_replace("memberfirstname", "Member first name", $valErrors);
						
			return $valErrors;
		}
		
		private function clean_validation_errors_validate_mahasamadhi_registrants( $valErrors )
		{
			$valErrors = str_replace("registrantlastname", "Registrant last name", $valErrors);
			$valErrors = str_replace("registrantfirstname", "Registrant first name", $valErrors);
			$valErrors = str_replace("registrantcity", "Registrant city", $valErrors);
			$valErrors = str_replace("registrantstate", "Registrant state", $valErrors);
						
			return $valErrors;
		}

	}

?>